package de.bensoft.jrail.client;

import javafx.application.Application;
import javafx.stage.Stage;

import javax.enterprise.util.AnnotationLiteral;

import org.apache.log4j.Logger;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;

import de.bensoft.jrail.client.common.StartupScene;

public class ClientMain extends Application {

	private static Logger LOG = Logger.getLogger(ClientMain.class);
	

	/**
	 * Main method for starting the jrail application
	 * @param args
	 */
	public static void main(String[] args) {
		Application.launch(ClientMain.class, new String[] { });
	}


	@Override
	public void start(Stage primaryStage) throws Exception {
		
		LOG.info("Starting CDI");
		WeldContainer container = new Weld().initialize();
		container.event().select(Stage.class, new AnnotationLiteral<StartupScene>() {}).fire(primaryStage);
		
		
		
		
		// Load MainForm
		/*final Parent root = fxmlLoader.load(getClass().getResource("/de/bensoft/jrail/client/ui/mainform/MainForm.fxml")).getRoot();
		
		Scene s = new Scene(root, 600, 400);
		s.getStylesheets().add(getClass().getResource("/style/style.css").toExternalForm());
		
		primaryStage.setScene(s);
		primaryStage.setTitle("jRAIL");
		primaryStage.show();


		primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {

			public void handle(WindowEvent arg0) {
				System.exit(0);
			}
					
		});*/
	}
	

	
}
